<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>拍卖列表</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            line-height: 1.6;
        }
        h1 {
            color: #333;
            text-align: center;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
            position: sticky;
            top: 0;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        tr:hover {
            background-color: #f1f1f1;
        }
        .auction-image {
            max-width: 100px;
            max-height: 100px;
        }
        .auction-desc {
            max-width: 300px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        table { width: 100%; border-collapse: collapse; }
        th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
        th { background-color: #f2f2f2; }
        .action-links a { margin-right: 10px; }
    </style>
</head>
<body>
<h1>拍卖商品列表</h1>
<a href="AuctionServlet?opr=toAdd">添加新拍卖</a>

<table>
    <thead>
    <tr>
        <th>名称</th>
        <th>起拍价</th>
        <th>底价</th>
        <th>开始时间</th>
        <th>结束时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach var="auction" items="${list}">
        <tr>
            <td>${auction.auctionName}</td>
            <td><fmt:formatNumber value="${auction.auctionStartPrice}" type="currency"/></td>
            <td><fmt:formatNumber value="${auction.auctionUpset}" type="currency"/></td>
            <td><fmt:formatDate value="${auction.auctionStartTime}" pattern="yyyy-MM-dd HH:mm"/></td>
            <td><fmt:formatDate value="${auction.auctionEndTime}" pattern="yyyy-MM-dd HH:mm"/></td>
            <td class="action-links">
                <a href="AuctionServlet?opr=selectById&auctionId=${auction.auctionId}">查看</a>
                <a href="AuctionServlet?opr=toUpdate&auctionId=${auction.auctionId}">修改</a>
                <a href="AuctionServlet?opr=delete&auctionId=${auction.auctionId}"
                   onclick="return confirm('确定要删除吗？')">删除</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
</body>
</html>